﻿
using System.Windows.Forms;

namespace StudyWinform
{
    public partial class Form1 : Form
    {

        //private Button btn;
        public Form1()
        {
            InitializeComponent();

        }

        private void button_login(object sender, System.EventArgs e)
        {

            //获取账号密码
            string acount = userName.Text;
            string psd = password.Text;
            //MessageBox.Show($"账号是：{acount}，密码是：{psd}");

            //验证账号密码
            if (acount == "123" && psd == "456") {
                //MessageBox.Show("登录成功");
                //登录成功后，隐藏登录框
                this.Hide();

                //因为都继承Form窗体，直接显示就行
                //一般都是通过构造函数进行传值
                Index index = new Index(acount);
                index.Show();             
            }
            else
            {
                MessageBox.Show("您输入账号或密码输入的有误");
            }
        }
    }
}
